<?php
header('Refresh: 10');
$file = 'http://vistar-capture.web.cern.ch/vistar-capture/lhc1.png';
$im = imagecreatefrompng("$file");
$b1 = "Beam 1 Status";
$b11 = imagecolorat($im, 870, 561);
$b12 = imagecolorat($im, 870, 590);
$b13 = imagecolorat($im, 870, 619);
$b14 = imagecolorat($im, 870, 647);
$b15 = imagecolorat($im, 870, 676);
$b16 = imagecolorat($im, 870, 705);
$b2 = "Beam 2 Status";
$b21 = imagecolorat($im, 942, 561);
$b22 = imagecolorat($im, 942, 590);
$b23 = imagecolorat($im, 942, 619);
$b24 = imagecolorat($im, 942, 647);
$b25 = imagecolorat($im, 942, 676);
$b26 = imagecolorat($im, 942, 705);

ob_start();
echo "$b1<br> $b11<br> $b12<br> $b13<br> $b14<br> $b15<br> $b16<br>";
$temp = ob_get_contents();
$temp = str_replace(65280, "True", $temp);
$temp = str_replace(16711680, "False", $temp);
ob_end_clean();
echo "$temp";

ob_start();
echo "<br>$b2<br> $b21<br> $b22<br> $b23<br> $b24<br> $b25<br> $b26";
$temp = ob_get_contents();
$temp = str_replace(65280, "True", $temp);
$temp = str_replace(16711680, "False", $temp);
ob_end_clean();
echo "$temp<br>";

ob_start();
imagepng($im);
$contents =  ob_get_contents();
ob_end_clean();

echo "<img src='data:image/png;base64,".base64_encode($contents)."' />";

imagedestroy($im);
?>